package com.jty.module_user.viewmodel

import com.blankj.utilcode.util.RegexUtils
import com.czl.lib_base.config.AppConstants
import com.jty.lib_base.base.AppManager
import com.jty.lib_base.base.BaseViewModel
import com.jty.lib_base.base.MyApplication
import com.jty.lib_base.binding.command.BindingAction
import com.jty.lib_base.binding.command.BindingCommand
import com.jty.lib_base.bus.event.SingleLiveEvent
import com.jty.lib_base.data.DataRepository


/**
 * author: zhouyh
 * created on: 2021/9/18 5:35 下午
 * description:主页viewmodel
 */
class SetViewModel(application: MyApplication, model: DataRepository) :
    BaseViewModel<DataRepository>(application, model) {

    val uc = UIChangeEvent()

    override fun onCreate() {
        super.onCreate()
        tvTitle.set("设置")
    }

    /**
     * UI刷新事件 用于观察者
     */
    class UIChangeEvent{
        val onClickOutLogin: SingleLiveEvent<Void> = SingleLiveEvent()
    }

    val onClickOutLogin: BindingCommand<Void> = BindingCommand(BindingAction {
        uc.onClickOutLogin.call()
    })
    val onClickModifyPwd: BindingCommand<Void> = BindingCommand(BindingAction {
        startContainerActivity(AppConstants.Router.User.F_MODIFYPWD)
    })

    val onClickVersionUpdate: BindingCommand<Void> = BindingCommand(BindingAction {
        startContainerActivity(AppConstants.Router.User.F_VERSIONUPDATE)
    })


}